package cn.iocoder.yudao.module.promotion.dal.mysql.message;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.promotion.dal.dataobject.message.MessageDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.promotion.controller.admin.message.vo.*;

/**
 * 留言管理 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface MessageMapper extends BaseMapperX<MessageDO> {

    default PageResult<MessageDO> selectPage(MessagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MessageDO>()
                .eqIfPresent(MessageDO::getMemberId, reqVO.getMemberId())
                .likeIfPresent(MessageDO::getMemberName, reqVO.getMemberName())
                .eqIfPresent(MessageDO::getMemberMobile, reqVO.getMemberMobile())
                .betweenIfPresent(MessageDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(MessageDO::getContent, reqVO.getContent())
                .orderByDesc(MessageDO::getId));
    }

}